package cn.pcManage.portalManage.service.impl;

import cn.common.common.model.ServerResponse;
import cn.common.user.model.BaseUserInfo;
import cn.pcManage.portalManage.service.IPortalService;
import cn.pcManage.userManage.dao.UserInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Zhang on 2019/1/3.
 */
@Service
public class PortalService implements IPortalService {
    @Autowired
    UserInfoMapper userInfoMapper;

    @Override
    public ServerResponse<?> userLogin(String userName, String userPass) {
        BaseUserInfo userInfo = userInfoMapper.selectByUserName(userName);
        if (userInfo == null){
            return ServerResponse.createByErrorMessage("用户不存在");
        }else if (!userInfo.getPassword().equals(userPass)){
            return ServerResponse.createByErrorMessage("密码不正确");
        }else {
            return ServerResponse.createBySuccessMessage("");
        }
    }
}
